{% extends "mturk/base_app.html" %}

{% block extrahead %}
<script src="/code/js/prototype.js"></script>

<script>
var run_block=function(worker )
{
      new Ajax.Updater('block_tgt_'+worker, '/mt/ban_worker/'+worker+'/', {
          });
}

var run_unblock=function(worker )
{
      new Ajax.Updater('block_tgt_'+worker, '/mt/unban_worker/'+worker+'/', {
          });
}
</script>

{% endblock %}

{% block content %}
<hr/>
<table><tr><td>Session code</td><td>Worker</td><td>Num submissions</td><td>Grades<br/>15/10/7/3</td><td>Grading link</td><td>Total by worker</td></tr>
{% for s in session_stats %}
<tr><td>{{session.code}}</td><td><a href="/mt/dashboard/worker_internal/{{s.worker}}/">{{s.worker}}</a></td><td>{{s.count}}</td>

  <td>{{s.num_exceptional}}/{{s.num_good}}/{{s.num_ok}}/{{s.num_bad}}</td>

<td><a href="/mt/grading/by_worker/{{session.code}}/{{s.worker}}/">grade ({{s.num_to_grade}} )</a></td>
<td>{{s.total}}</td>
<td>

<div id='block_tgt_{{s.worker}}'>
{% if s.banned %}
<a href='#' onclick="run_unblock('{{s.worker}}');return false">unban</a>
{% else %}
<a href='#' onclick="run_block('{{s.worker}}');return false">ban</a>
{% endif %}

</div>
</td>
<td>
{% if perms.mturk.pay_bonus %}
<a href="/mt/payments/create/simple2/{{s.worker}}/{{session.code}}/" target="bonus_wnd">Grant bonus</a>
{% endif %}
</td>
</tr>
{% endfor %}
</table>

{% endblock %}
